#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int n,r[N],ri,flag[N],dead[N],ans;
int main()
{
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	scanf("%d",&n);
	ans=n;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&ri);
		r[ri]++;
	}
	int i=1,j=1;
	while(i<=N-5&&j<=N-5)
	{
		while((r[i]==0||dead[i]==r[i])&&i<=N-5) i++;
		if(i>N-5) break;
		j=i+1;
		while((r[j]==0||flag[j]==r[j])&&j<=N-5) j++;
		if(j>N-5) break;
		while(dead[i]<r[i]&&flag[j]<r[j])
		{
			dead[i]++;
			flag[i]++;
			flag[j]++;
			ans--;
			//printf("%d %d\n",i,j);
		}
	}
	printf("%d",ans);
	return 0;
}
/*
10
136 136 136 2417 136 136 2417 136 136 136
*/
